﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Baosight.ZNH.ZMCommon;
using Baosight.ZNH.ZMCommon.ChildWindows;
using Baosight.Platform.Core;
using Baosight.Platform.Core.ServiceModel;

namespace Baosight.ZNH.ZMCE.UI.PopWindows
{
    /// <summary>
    /// 设备卡片中引入标准——引入其他标准
    /// </summary>
    /// Copyright:Baosight Software LTD.co Copyright (c) 2011
    /// Company:上海宝信软件股份有限公司
    /// Author: 张志芳
    /// Version: 1.0
    /// History:
    ///       2011-04-18  张志芳   [创建]
    ///
    public partial class AddOtherStandard : EFViewCmes
    {
        public AddOtherStandard()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void grid_RowDoubleClick(object sender, Platform.Core.UI.Controls.RowDoubleClickEventArgs e)
        {
            Dictionary<string, object> args = new Dictionary<string, object>();
            args.Add("cordKeyId", cordKeyId.Value);
            args.Add("standardKeyId", e.DataItem.GetType().GetProperty("fdKeyId").GetValue(e.DataItem, null));
            EIInfo eiInfo = new EIInfo();
            eiInfo.SetAttributes(args);
            eiInfo.Attributes.Add(EIConstants.ServiceNameKey, "ZMCEC1");
            eiInfo.Attributes.Add(EIConstants.MethodNameKey, "addOtherStandard");

            this.Submit(eiInfo, doWorkCompleted);
        }

        /// <summary>
        /// 回调函数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void doWorkCompleted(object sender, DoWorkCompletedEventArgs e)
        {
            if (e.EIInfo.Status != -1)
            {
                CmesWindows _window = this.Parent as CmesWindows;
                _window.DialogResult = false;
                _window.Close();
            }
            else
            {
                BaseTools.OpenEFWindowAlert("发生错误：" + e.EIInfo.GetMsg(), null);
            }
        }
    }
}
